/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package java113Test;

import java.io.*;
import java.util.Properties;
import java113.labs.AddressDAOTest;
import java113.labs.AddressTest;
import java113.labs.ClassificationTest;
import java113.labs.NameTest;
import java113.project.util.SysLogger;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import test.base.OrderTest;
import test.base.ProcessOrderTest;
import test.threads.ScannerTest;
import test.threads.ThreadedWriterTest;
import test.xml.ReadXMLOrderTest;
import test.xml.WriteXMLOutputTest;

/**
 *
 * @author matthew
 */
public class ProjectFourTestSuite extends TestCase {
    
    public ProjectFourTestSuite(String testName) {
        super(testName);
    }

    public static Test suite() {

        Properties properties = new Properties();

        try {

            properties.load(new FileInputStream("./config/test.properties"));

        } catch(IOException ioe) {

            System.out.println("Can't load the properties file");

            ioe.printStackTrace();

        } catch(Exception e) {

            System.out.println("Problem: " + e);

            e.printStackTrace();

        }

        properties.setProperty("webApp", "false");

        new SysLogger(properties).init();

        TestSuite suite = new TestSuite("NewTestSuite");

        suite.addTest(new ReadXMLOrderTest("testGetAndSetProperties", properties));
        suite.addTest(new ReadXMLOrderTest("testGetAndSetOrders", properties));
        suite.addTest(new ReadXMLOrderTest("testGetAndSetCounter", properties));
        suite.addTest(new ReadXMLOrderTest("testGetAndSetOrder", properties));
        suite.addTest(new ReadXMLOrderTest("testGetAndSetM_oContents", properties));
        suite.addTest(new ReadXMLOrderTest("testLoad", properties));
        suite.addTest(new ReadXMLOrderTest("testStartElement", properties));
        suite.addTest(new ReadXMLOrderTest("testEndElement", properties));
        suite.addTest(new ReadXMLOrderTest("testCharacters", properties));
        suite.addTest(new ReadXMLOrderTest("testReadCharges", properties));

        suite.addTest(new WriteXMLOutputTest("testGetAndSetProperties", properties));
        suite.addTest(new WriteXMLOutputTest("testGetAndSetOrders", properties));
        suite.addTest(new WriteXMLOutputTest("testGetAndSetCounter", properties));
        suite.addTest(new WriteXMLOutputTest("testCreateDocument", properties));
        suite.addTest(new WriteXMLOutputTest("testWriteXML", properties));
        suite.addTest(new WriteXMLOutputTest("testWrite", properties));

        suite.addTest(new OrderTest("testCustomerName"));
        suite.addTest(new OrderTest("testCustomerNumber"));
        suite.addTest(new OrderTest("testExtendedPrice"));
        suite.addTest(new OrderTest("testItem"));
        suite.addTest(new OrderTest("testQuantity"));
        suite.addTest(new OrderTest("testUnitPrice"));
        suite.addTest(new OrderTest("testHandlingCharge"));
        suite.addTest(new OrderTest("testHChargeQuantity"));
        suite.addTest(new OrderTest("testHChargeAmount"));
        suite.addTest(new OrderTest("testCalExtendedPrice"));
        suite.addTest(new OrderTest("testCalHandlingCharge"));
        suite.addTest(new OrderTest("testDisplay"));

        suite.addTest(new ProcessOrderTest("testReadOrder", properties));
        suite.addTest(new ProcessOrderTest("testReadCharges", properties));
        suite.addTest(new ProcessOrderTest("testCreateOrder", properties));
        suite.addTest(new ProcessOrderTest("testWriteOutput", properties));
        suite.addTest(new ProcessOrderTest("testProperties", properties));
        suite.addTest(new ProcessOrderTest("testOrders", properties));
        suite.addTest(new ProcessOrderTest("testToString", properties));

        suite.addTest(new ScannerTest("testScan", properties));
        suite.addTest(new ScannerTest("testProperties", properties));
        suite.addTest(new ScannerTest("testToString", properties));

        suite.addTest(new ThreadedWriterTest("testWrite", properties));
        suite.addTest(new ThreadedWriterTest("testProperties", properties));
        suite.addTest(new ThreadedWriterTest("testLedger", properties));
        suite.addTest(new ThreadedWriterTest("testToString", properties));

        suite.addTest(new AddressTest("testGetAndSetId"));
        suite.addTest(new AddressTest("testGetAndSetStreet"));
        suite.addTest(new AddressTest("testGetAndSetCity"));
        suite.addTest(new AddressTest("testGetAndSetState"));
        suite.addTest(new AddressTest("testGetAndSetZip"));
        suite.addTest(new AddressTest("testToString"));

        suite.addTest(new ClassificationTest("testGetAndSetId"));
        suite.addTest(new ClassificationTest("testGetAndSetType"));
        suite.addTest(new ClassificationTest("testToString"));

        suite.addTest(new NameTest("testGeAndSettId"));
        suite.addTest(new NameTest("testGetAndSetClassification_id"));
        suite.addTest(new NameTest("testGetAndSetAddress_id"));
        suite.addTest(new NameTest("testGetAndSetLast"));
        suite.addTest(new NameTest("testGetAndSetFirst"));
        suite.addTest(new NameTest("testToString"));

        suite.addTest(new AddressDAOTest("testGetAddress", properties));
        suite.addTest(new AddressDAOTest("testToString", properties));

        return suite;

    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
    }

}
